<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>修改信息</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="../plugins/layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
	</head>
	<body>
		<div style="margin: 15px;">
			<blockquote class="layui-elem-quote">
				修改管理员账号密码
			</blockquote>

			<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
				<legend>修改信息</legend>
			</fieldset>

			<form class="layui-form" action="">
				<div class="layui-form-item">
					<label class="layui-form-label">账号</label>
					<div class="layui-input-block">
						<input type="text" name="account" lay-verify="title" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">密码</label>
					<div class="layui-input-block">
						<input type="password" name="Password" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
					</div>
				</div>
			</form>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" id="add" lay-submit="" lay-filter="demo1">修改</button>
				</div>
			</div>
		</div>

		<!--模板-->
		<script type="text/javascript" src="/admin/plugins/layui/layui.js"></script>
		<script type="text/javascript" src="../js/jquery.min.js"></script>
		<script type="text/javascript" src="../js/template.js"></script>
		<script type="text/javascript" src="/admin/js/publish.js"></script>
		<script>
			layui.use('layer', function() {
				var layer = layui.layer;
			});
			$("#add").click(function() {

				var account = $("input[name='account']").val();
				if(account==null||account==""){
					toast("请输入账号");
					return;
				}
				//检查密码
				var password = $("input[name='Password']").val();
				if(password==null||password==""){
					toast("请输入密码");
					return;
				}

				if(password.length<6){
					toast("密码长度不能小于6位");
					return;
				}

				//添加
				$.ajax({
					url:"/admin/user/upAdmin?account="+account+"&password="+password+"&aid=1",
					type:'get',
					dataType:'json',
					success:function(response){
						//console.log(response);
						if(response.code==200){

							toast("修改成功，请重新登录");
							setTimeout(function(){
								top.location.href='/admin/login';
							},1000);

						}else{
							toast("修改失败");
						}
					}
				});
			});
		</script>
	</body>

</html>
